package com.blog.filter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created by 青水零 on 2022/07/11
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private HttpRequestInterceptor httpRequestInterceptor;

    // 配置拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //设置跨域的拦截器 ,/** 表示拦截所有请求
        registry.addInterceptor(httpRequestInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/**/login","/**/register","/**/sendEmail");
    }
}
